perm filename TEXEXT.SAI[TEX,DEK]2 blob
sn#492177 filedate 1980-01-25 generic text, type T, neo UTF8
entry; begin comment The (dummy) extension module of TEX.
In order to extend TEX without changing other modules, you can supply
procedures for the null procedures declared here. Most of these procedures
are called when TEX's routines come up with a case that is ordinarily
undefined (usually when processing a node of type "whatsit");
require "TEXHDR.SAI" source_file;
IFPARC
internal boolean color;
integer curbrightness, curhue, cursaturation;
integer oldbrightness, oldhue, oldsaturation;
ENDPARC
internal procedure initext # do this when initializing TEX;
begin IFPARC
curbrightness←0; oldbrightness←0;
curhue←0; oldhue←0;
cursaturation←0; oldsaturation←0;
color←false;
ENDPARC end;
internal procedure extop # do this when "\x" sensed in user input;
begin IFPARC integer octal, i, p;
do getnctok until curcmd ≠ spacer; backinput;
if scanstring("color") then color←true
else if scanstring("nocolor") then color←false
else if color then
begin
p←getnode(colornodesize);
mem[p]←whatsitnode lsh typed;
octal←0;
if scanstring("brightness") then
begin
mem[p+1]←brightness lsh 8;
for i ← 1 thru 3 do octal←8*octal+scandigit-"0";
if octal > '377 then octal←curbrightness←oldbrightness
else begin oldbrightness←curbrightness; curbrightness←octal; end;
end
else if scanstring("hue") then
begin
mem[p+1]←hue lsh 8;
for i ← 1 thru 3 do octal←8*octal+scandigit-"0";
if octal > '377 then octal←curhue←oldhue
else begin oldhue←curhue; curhue←octal; end;
end
else if scanstring("saturation") then
begin
mem[p+1]←saturation lsh 8;
for i ← 1 thru 3 do octal←8*octal+scandigit-"0";
if octal > '377 then octal←cursaturation←oldsaturation
else begin oldsaturation←cursaturation; cursaturation←octal; end;
end
else confusion;
mem[p+1]←mem[p+1]+(octal land '377);
mem[curnode]←mem[curnode]+p; curnode←p;
end;
ENDPARC end;
IFPARC internal procedure docolors;
begin
if curbrightness ≠ 0 then SetBrightness(curbrightness);
if curhue ≠ 0 then SetHue(curhue);
if cursaturation ≠ 0 then SetSaturation(cursaturation);
end;
ENDPARC
internal procedure dumpext(integer p) # do this in procedure dumpnodelist;
begin IFPARC
case type(p) of begin
[brightness] print("brightness "&cvos(colorval(p)));
[hue] print("hue "&cvos(colorval(p)));
[saturation] print("saturation "&cvos(colorval(p)));
else confusion
end;
ENDPARC end;
internal procedure destroyext(integer p) # do this in procedure dsnodelist;
begin IFPARC
freenode(p,colornodesize);
ENDPARC end;
internal procedure eqdestroyext(integer p) # do this in procedure eqdestroy;
;
internal procedure hpackext(integer p) # do this in procedure hpackage;
;
internal procedure vpackext(integer p) # do this in procedure vpackage;
;
internal procedure pageext(integer p) # do this in the addtopage routine;
;
internal procedure justext(integer p) # do this in the justification routine;
;
internal procedure houtext(integer p; reference real x,y) # do this in shipout;
;
internal procedure voutext(integer p; reference real x,y) # do this in shipout;
;
comment in houtext, x and y are coordinates of the reference point, while
in voutext they are coordinates of the upper left corner;
internal procedure finishext # do this just before terminating TEX;
;
end